//
//  UIFont+LYAdd.h
//  LYDevelopKit
//
//  Created by 李阳 on 2018/8/14.
//

#import <UIKit/UIKit.h>

@interface UIFont (LYAdd)


/**
 注册字体

 @param name 字体名称 default is `iconfont.ttf`
 
 @warning 如果在 `info.plist` `Fonts provided by application` 字段中注册了该字体，无需调用此方法
 */
+ (void)registerIconFontWithName:(NSString *)name;
+ (void)registerIconFontWithFileUrl:(NSURL *)fileUrl;

/// 设置 `iconfont` 文件名
+ (void)setDefaultIconfontFileName:(NSString *)name;

+ (UIFont *)iconfontWithSize:(CGFloat)size;


@end

@interface NSString (IconFont)

/// 16进制的值 eg @"12" -> 18
- (NSInteger)hexValue;

/**
 icon编码

 @return icon编码
 
 @discussion: h
 
 Sample Code:
 
 label.font = [UIFont iconfontWithSize:30];
 
 label.text = @"627".iconUnicode;
 
 @"634".iconUnicode -> @"\U0000e634"
 */
- (NSString *)iconUnicode;

@end

@interface UIImage (IconFont)


+ (void)setIconFontImageAppearanceColor:(UIColor *)color;

/**
 制作iconfont图标

 @param font 字体
 @param text iconfont编码
 @param color 颜色
 @orientation 方向
 @return 生成后的图片
 
 @discussion: h
 
 Sample Code:
 
 [button setImage:[UIImage iconWithSize:30 unicode:@"620".iconUnicode color:[UIColor orangeColor] orientation:0] forState:UIControlStateNormal];

 */
+ (UIImage *)iconWithFont:(UIFont *)font
                  unicode:(NSString *)text
                    color:(UIColor *)color
              orientation:(UIImageOrientation)orientation;

+ (UIImage *)iconWithFontSize:(CGFloat)fontSize
                      unicode:(NSString *)text
                        color:(UIColor *)color
                  orientation:(UIImageOrientation)orientation;

+ (UIImage *)iconWithFontSize:(CGFloat)fontSize
                      unicode:(NSString *)text
                        color:(UIColor *)color;

+ (UIImage *)iconWithFontSize:(CGFloat)fontSize
                      unicode:(NSString *)text
                  orientation:(UIImageOrientation)orientation;

+ (UIImage *)iconWithFontSize:(CGFloat)fontSize
                      unicode:(NSString *)text;

@end





